﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Administrator/Admincp.Master" AutoEventWireup="true" CodeBehind="QuanLyChiPhi.aspx.cs" Inherits="Moving03.Administrator.WebForm10" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <p>
        <strong>CHI TIẾT</strong></p>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form id="form1" runat="server">
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:UPSConnectionString %>" 
        SelectCommand="SELECT [Id_MaQGia], [TenQuocGia] FROM [DanhSachQuocGia]"></asp:SqlDataSource>
    <br />
    <br />
    &nbsp;&nbsp;&nbsp; <strong style="color: #6666FF">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DANH SÁCH TUYẾN VẬN 
    CHUYỂN</strong><br />
    <br />
    <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="Id_CPDDNNgoai" DataSourceID="SqlDataSource3" 
        onrowupdating="GridView2_RowUpdating" CellPadding="4" ForeColor="#333333" 
        GridLines="None" style="width:90%; margin:auto; text-align:center" 
        onrowdeleted="GridView2_RowDeleted" >
       
        <AlternatingRowStyle BackColor="White" />
       
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />

            <asp:TemplateField HeaderText="Chọn">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink2" runat="server" Text="Xem" 
                        NavigateUrl='<%# "ThongTinChiTietTuyen.aspx?ID="+Eval("Id_CPDDNNgoai") %>'>Xem</asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>

            <asp:BoundField DataField="Id_CPDDNNgoai" HeaderText="Mã Tuyến" 
                InsertVisible="False" ReadOnly="True" SortExpression="Id_CPDDNNgoai" />
            <asp:BoundField DataField="Ten" HeaderText="Ten" SortExpression="Ten" 
                Visible="False" />
           <asp:TemplateField HeaderText="Quốc Gia Đi">
                <ItemTemplate>
                    <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2" DataTextField="TenQuocGia" DataValueField="Id_MaQGia"   AutoPostBack="false" SelectedValue='<%# Eval("Id_QuocGia1") %>'> 
                    </asp:DropDownList>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Quốc Gia Đến">
                <ItemTemplate>
                    <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource2" DataTextField="TenQuocGia" DataValueField="Id_MaQGia"  SelectedValue='<%# Eval("Id_QuocGia2") %>'> 
                    </asp:DropDownList>
                </ItemTemplate>
            </asp:TemplateField>
            
            <asp:BoundField DataField="NgayGoiHangBinhThuong" 
                HeaderText="Ngày Gởi Bình Thường" SortExpression="NgayGoiHangBinhThuong" />
            <asp:BoundField DataField="NgayGoiHangNhanh" HeaderText="Ngày Gởi Nhanh" 
                SortExpression="NgayGoiHangNhanh" />
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:UPSConnectionString %>" 
        DeleteCommand="DELETE FROM [ChiPhiDiaDiemNuocNgoai] WHERE [Id_CPDDNNgoai] = @Id_CPDDNNgoai" 
        InsertCommand="INSERT INTO [ChiPhiDiaDiemNuocNgoai] ([Ten], [Id_QuocGia2], [Id_QuocGia1], [GiaBinhThuong], [GiaNhanh], [NgayGoiHangBinhThuong], [NgayGoiHangNhanh]) VALUES (@Ten, @Id_QuocGia2, @Id_QuocGia1, @GiaBinhThuong, @GiaNhanh, @NgayGoiHangBinhThuong, @NgayGoiHangNhanh)" 
        SelectCommand="SELECT [Id_CPDDNNgoai], [Ten], [Id_QuocGia2], [Id_QuocGia1], [NgayGoiHangBinhThuong], [NgayGoiHangNhanh] FROM [ChiPhiDiaDiemNuocNgoai]" 
        
        
        UpdateCommand="UPDATE [ChiPhiDiaDiemNuocNgoai] SET [Ten] = @Ten, [Id_QuocGia2] = @Id_QuocGia2, [Id_QuocGia1] = @Id_QuocGia1, [NgayGoiHangBinhThuong] = @NgayGoiHangBinhThuong, [NgayGoiHangNhanh] = @NgayGoiHangNhanh WHERE [Id_CPDDNNgoai] = @Id_CPDDNNgoai" 
        oninserted="SqlDataSource3_Inserted" onupdating="SqlDataSource3_Updating">
        <DeleteParameters>
            <asp:Parameter Name="Id_CPDDNNgoai" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Ten" Type="String" />
            <asp:Parameter Name="Id_QuocGia2" Type="Int32" />
            <asp:Parameter Name="Id_QuocGia1" Type="Int32" />
            <asp:Parameter Name="GiaBinhThuong" Type="Double" />
            <asp:Parameter Name="GiaNhanh" Type="Double" />
            <asp:Parameter Name="NgayGoiHangBinhThuong" Type="Int32" />
            <asp:Parameter Name="NgayGoiHangNhanh" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Ten" Type="String" />
            <asp:Parameter Name="Id_QuocGia2" Type="Int32" />
            <asp:Parameter Name="Id_QuocGia1" Type="Int32" />
            <asp:Parameter Name="GiaBinhThuong" Type="Double" />
            <asp:Parameter Name="GiaNhanh" Type="Double" />
            <asp:Parameter Name="NgayGoiHangBinhThuong" Type="Int32" />
            <asp:Parameter Name="NgayGoiHangNhanh" Type="Int32" />
            <asp:Parameter Name="Id_CPDDNNgoai" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    &nbsp;&nbsp;&nbsp;<asp:Label ID="Label1" runat="server" ForeColor="Red" 
        Text="Label"></asp:Label>
&nbsp;<p style="margin-left: 200px">
        <asp:Button ID="Button1" runat="server" BackColor="#FF9933" Font-Bold="True" 
            ForeColor="White" onclick="Button1_Click" Text="Thêm Tuyến Mới" />
    <br />
    </p>
    </form>
</asp:Content>
